<?php 

require("includes/basic.php");

?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_getImage = "-1";

if (isset($_GET['logo_id'])) {
  $colname_getImage = $_GET['logo_id'];
}

mysql_select_db($db, $link);
$query_getImage = sprintf("SELECT name, type FROM client_logo WHERE logo_id = %s", GetSQLValueString($colname_getImage, "int"));
$getImage = mysql_query($query_getImage, $link) or die(mysql_error());

$row_getImage = mysql_fetch_assoc($getImage);

$totalRows_getImage = mysql_num_rows($getImage);
header('Content-type: ' . $row_getImage['name']);
echo $row_getImage['name'];
//mysql_free_result($getImage);
?>
